Grails: Hello world!

Categories: Development Notes; Tagged with: ; @ December 2nd, 2012 23:57

1. Download Grails, unzip.

2. Add the bin path into PATH

3. run: grails –version, if you not set JAVA_HOME yet, there will be some info about this.

now, you are ready to create the application:

 

1.  Run: grails create-app helloworld  there’ll be some mesg about the application path.
Note: can not use this command in “Interactive Mode”

2. cd helloworld

3. Create controller:  grails>  create-controller  hello, get some info after success:

| Created file grails-app/controllers/helloworld/HelloController.groovy
| Created file grails-app/views/hello
| Created file test/unit/helloworld/HelloControllerTests.groovy

4.  Modify the controller:

package helloworld

class HelloController {

    def index() { 
		render "Hello World!!"
	}
}

5. Ok, everything is ready, now, just run the application:  grails> run-app

image

Negative to the page,  the console will be there, click the application link: “Hello world!!”

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.